/***
 * 执行终端命令相关的代码
 */
const { spawn } = require('child_process')//子进程child_process

const commandSpawn = async (...args) => {
  return new Promise(resolve => {
    const childProcess = spawn(...args)
    childProcess.stdout.pipe(process.stdout)
    childProcess.stderr.pipe(process.stderr)
    childProcess.on('close', () => {
      resolve()
    })
  })
}

module.exports = {
  commandSpawn
}